package com.adteam.xmap.manager.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.adteam.xmap.entity.Building;
import com.adteam.xmap.manager.BuildingManager;

public class BuildingManagerImpl extends HibernateDaoSupport implements BuildingManager {

	public void addBuilding(Building building) {

		getHibernateTemplate().save(building);
		
	}

	public void delBuilding(int id) {

		getHibernateTemplate().delete(findBuildingById(id));
	}

	public List findAllBuildings() {

		return getHibernateTemplate().find("select b from Building b");
		
	}

	public Building findBuildingById(int id) {

		return (Building)getHibernateTemplate().load(Building.class, id);
		
		
	}

	public void updateBuilding(Building building) {

		getHibernateTemplate().update(building);
		
	}

}
